package com.zjw.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

public class PathUtils {

    public static final String generateFilePath(String fileName){
//        获取当前时间并格式化
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
        String datePath = sdf.format(new Date());

//        获取文件名后缀
        String type = fileName.substring(fileName.lastIndexOf("."));


        return new StringBuilder().append(datePath).append("/").append(UUID.randomUUID().toString()).append(type).toString();
    }

}
